<template>
  <view>
    <view
        :style="'padding-top:' + nTop + 'px;height:' + nHeight + 'px;line-height:' + nHeight + 'px;--color:' + color + ';'"
        class="navigationBox">
      <view :style="'height:' + nHeight + 'px;top:' + nTop + 'px'" class="nBar">
        <navigator :openType="pages.length == 1 ? 'switchTab' : 'navigateBack'"
                   :url="pages.length == 1 ? '/pages/index/index4' : ''" class="ico"
                   hoverClass="none">
          {{ pages.length == 1 ? '' : '' }}
        </navigator>
        <view class="title">
          <view v-if="DJS.flag == 1" class="djsbox">
            <text class="i ico"> {{ DJS.title }}</text>
            <block v-if="djs_H > 0">
              <text class="font">{{ djs_H }}</text>
              <text class="span">时</text>
            </block>
            <block v-if="djs_M > 0">
              <text class="font">{{ djs_M }}</text>
              <text class="span">分</text>
            </block>
            <text class="font">{{ djs_S }}</text>
            <text class="span">秒</text>
          </view>
          <text v-else style="margin-left: 85rpx">{{ DJS.title }}</text>
        </view>
      </view>
    </view>
    <view :style="'margin-top:' + nTH + 'px;--color:' + color + ';--rgbcolor:' + rgbcolor + ';'" class="hx_detail_BN">
      <image :src="D.path_b" mode="widthFix"></image>
    </view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';'" class="hx_top">
      <view class="hx_ilist">
        <view class="h1">{{ D.title }}</view>
        <view class="dl">
          <view class="dt">
            <text class="i ico"></text>
            本期参与嘉宾
          </view>
          <view class="dd">
            <text class="i ico">
              
              <text class="b">{{ BM.num || 0 }}人</text>
            </text>
            已参与
          </view>
        </view>
        <view class="ul">
          <block v-if="BM.num > 0">
            <view v-for="(item, index) in BM.ulist" :key="index" class="li">
              <image :src="item" mode="aspectFill"></image>
            </view>
            <view class="li more">
              <text class="i ico"></text>
            </view>
          </block>
          <view v-else class="nodata">
            <text class="i ico"></text>
            暂时还没有人报名
          </view>
        </view>
        <view v-if="MARQUEE.num > 0 && MARQUEE.list.length > 0" class="iMarqueeBox">
          <text class="h5">成功{{ MARQUEE.num }}对</text>
          <swiper :autoplay="true" :circular="true" :vertical="true" interval="2000">
            <swiper-item v-for="(item, index) in MARQUEE.list" :key="index" class="iMarquee">
              <view class="li">{{ item }}</view>
            </swiper-item>
          </swiper>
        </view>
      </view>
    </view>
    <view v-if="tjarr.length > 0" :style="'--rgbcolor:' + rgbcolor + ';'" class="dtl_box">
      <view class="tbody">加入条件</view>
      <view class="tjul">
        <view v-for="(item, index) in tjarr" :key="index" class="li">
          <text class="font C999">{{ item.t }}：</text>

          <text>{{ item.v }}</text>
        </view>
      </view>
    </view>
    <view :style="'--rgbcolor:' + rgbcolor + ';'" class="dtl_box">
      <view class="tbody tbody2">活动说明</view>
      <rich-text :nodes="content" class="C"></rich-text>
    </view>
    <view class="blank"></view>
    <view :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';'" class="hx_i_btm">
      <view class="a" @tap="telFn">
        <text class="i ico"></text>
        <text class="span">幸福热线</text>
      </view>
      <view class="a" @tap="kefuFn">
        <text class="i ico"></text>
        <text class="span">咨询客服</text>
      </view>
      <view class="a">
        <text :class="'span' + BTN.class" @tap="BTNfn">{{ BTN.title }}</text>
      </view>
    </view>
    <view v-if="kefushow" class="mask3 alpha0_100">
      <view class="div_box big_normal" style="--div_box_width: 70%; --div_box_height: 666rpx">
        <view class="close ico" @tap="kefu_closeFn"></view>
        <view class="truename">咨询客服</view>
        <view class="kf_wxpic">
          <image :showMenuByLongpress="true" :src="KEFU.wxpic"></image>
        </view>
        <view class="kf_text">长按识别二维码添加客服微信</view>
        <view class="kf_text">咨询客服1对1人工服务</view>
      </view>
    </view>
    <!-- parse <include src="../component/sorry.wxml"></include> -->
    <sorry></sorry>
    <!--    <block>-->
    <!--      <view v-if="div_vip" :class="'mask2 ' + mask_class" data-maskid="div_vip" @tap="mask_closeFn">-->
    <!--        <view :style="'&#45;&#45;div_box_width:600rpx;&#45;&#45;div_box_height:' + (div_vip_H > 0 ? div_vip_H : 480) + 'rpx;'"-->
    <!--              class="div_box div_vip"-->
    <!--              @tap.stop.prevent="emptyFn">-->
    <!--          <view class="closebtm ico" data-maskid="div_vip" @tap.stop.prevent="mask_closeFn"></view>-->
    <!--          <view class="h1">{{ div_vip_title }}</view>-->
    <!--          <text v-if="!globalUtils.empty(div_vip_content)" class="C S15">{{ div_vip_content }}</text>-->
    <!--          <block v-else>-->
    <!--            <view class="C S15">开通VIP超级会员，专享超值权益</view>-->
    <!--            <view class="C S15">相亲成功率大大提升</view>-->
    <!--          </block>-->
    <!--          <view class="ico picico"></view>-->
    <!--          <view class="btn_btm btn44 ico" @tap.stop.prevent="vipFn"> 立即开通</view>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view v-if="div_cert" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_cert"-->
    <!--            @tap="mask_closeFn">-->
    <!--        <view class="div_box div_cert" style="&#45;&#45;div_box_width: 600rpx; &#45;&#45;div_box_height: 480rpx"-->
    <!--              @tap.stop.prevent="emptyFn">-->
    <!--          <view class="closebtm ico" data-closekind="back" data-maskid="div_cert" @tap.stop.prevent="mask_closeFn">-->
    <!--          </view>-->
    <!--          <view class="h1">{{ div_cert_title }}</view>-->
    <!--          <view class="C S15">成为认证用户，即享沟通特权</view>-->
    <!--          <view class="C S15">提高诚信值，杜绝虚假</view>-->
    <!--          <view class="ico picico"></view>-->
    <!--          <view class="btn_btm btn44 ico" @tap.stop.prevent="certFn">立即认证</view>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view v-if="div_data" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_data"-->
    <!--            @tap="mask_closeFn">-->
    <!--        <view :style="'&#45;&#45;div_box_width:600rpx;&#45;&#45;div_box_height:490rpx;&#45;&#45;color:' + color + ';&#45;&#45;rgbcolor:' + rgbcolor"-->
    <!--              class="div_box div_data"-->
    <!--              @tap.stop.prevent="emptyFn">-->
    <!--          <view class="closebtm ico" data-closekind="back" data-maskid="div_data" @tap.stop.prevent="mask_closeFn">-->
    <!--          </view>-->
    <!--          <view class="h1">{{ div_data_title }}</view>-->
    <!--          <view class="C S15">赶快去完善，解锁更多功能</view>-->
    <!--          <view class="C S15">完成资料，上传头像，受关注度暴增</view>-->
    <!--          <view class="C S15 Cf00">如果还未审核，请等待审核</view>-->
    <!--          <view class="ico picico"></view>-->
    <!--          <view class="btn_btm btn44 ico" @tap.stop.prevent="dataFn">立即完善</view>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--      <view v-if="div_gps" :class="'mask2 ' + mask_class" data-closekind="back" data-maskid="div_gps"-->
    <!--            @tap="mask_closeFn">-->
    <!--        <view :style="'&#45;&#45;div_box_width:550rpx;&#45;&#45;div_box_height:480rpx;&#45;&#45;color:' + color + ';&#45;&#45;rgbcolor:' + rgbcolor"-->
    <!--              class="div_box div_gps"-->
    <!--              @tap.stop.prevent="emptyFn">-->
    <!--          <view class="closebtm ico" data-closekind="back" data-maskid="div_gps" @tap.stop.prevent="mask_closeFn">-->
    <!--          </view>-->
    <!--          <view class="h1">{{ div_gps_title }}</view>-->
    <!--          <view class="C S15">授权后，将自动获取您当前位置</view>-->
    <!--          <view class="C S15">否则将无法使用《附近的人》功能</view>-->
    <!--          <view class="ico picico"></view>-->
    <!--          <view class="btn_btm btn44 ico" @tap.stop.prevent="gpsFn">同意获取位置</view>-->
    <!--        </view>-->
    <!--      </view>-->
    <!--    </block>-->
    <!-- parse <include src="../login.wxml"></include> -->
    <block>
      <view v-if="div_login" class="mask3 alpha0_100">
        <view
            class="div_box big_normal"
            style="--div_box_width: 82%; --div_box_height: 666rpx; background: -webkit-linear-gradient(top, #fde9ee 1%, #fff 150%); background-color: #fff"
        >
          <view :style="'border-color:rgba(' + rgbcolor + ',.2);'" class="m">
            <image mode="aspectFit" src="/static/res/img/photo_m.png"></image>
          </view>
          <view class="S22 B">登录后获得更精准推荐</view>
          <view class="loginagree">
            <checkbox-group @change="ifagreeFn">
              <label style="margin-left: -10rpx">
                <checkbox :style="'--color:' + color + ';'" value="1"></checkbox>
                <text class="C666 vmiddle">阅读并同意</text>
              </label>
            </checkbox-group>
            <navigator :style="'color:' + color" class="vmiddle" hoverClass="none"
                       url="/pagesA/about/law?kind=agreement">用户协议
            </navigator>
            <text class="C666 vmiddle">与</text>
            <navigator :style="'color:' + color + ';'" class="vmiddle" hoverClass="none"
                       url="/pagesA/about/law?kind=declara">隐私条款
            </navigator>
          </view>
          <button
              v-if="ifagree"
              :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
              class="btn5 W90_"
              openType="getPhoneNumber"
              @getphonenumber="getPhoneNumber"
          >
            <text>手机号快捷登录</text>
            <text :style="'color: ' + color + ';'">私密</text>
          </button>
          <button v-else :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';width:73%'"
                  class="btn5" @tap="ifagree_passFn">
            <text>手机号快捷登录</text>
            <text :style="'color: ' + color + ';'">私密</text>
          </button>
          <view class="C666" @tap="back">
            <text style="border-bottom: #999 1px solid">暂不登录</text>
          </view>
        </view>
      </view>
    </block>
  </view>
</template>

<script>
import globalUtils from "../../res/www.a9a.cn";
import Sorry from "../../components/sorry/sorry.vue";

var t;
var n;
var i = require('../../@babel/runtime/helpers/defineProperty');
var a = require('../../res/www.a9a.cn.js');
var app = getApp();
export default {
  components: {Sorry},
  computed: {
    globalUtils() {
      return globalUtils
    }
  },
  data() {
    return {
      nTitle: '',
      setInter: '',
      color: '',
      rgbcolor: '',
      tjarr: '',
      SHARE: '',

      D: {
        path_b: '',
        title: ''
      },

      BM: {
        num: '',
        ulist: []
      },

      MARQUEE: {
        num: 0,
        list: []
      },

      DJS: {
        flag: 0,
        title: ''
      },

      KEFU: {
        wxpic: ''
      },

      BTN: {
        class: '',
        title: ''
      },

      ios_ifpay: '',
      content: '',
      djs_H: '',
      djs_M: '',
      djs_S: '',
      kefushow: false,
      div_login: false,
      mask_class: '',
      ifagree: false,
      nTop: '',
      nHeight: '',
      pages: [],
      nTH: '',
      div_vip: '',
      div_vip_H: 0,
      div_vip_title: '',
      div_vip_content: '',
      div_cert: '',
      div_cert_title: '',
      div_data: '',
      div_data_title: '',
      div_gps: [],
      div_gps_title: ''
    };
  },
  onLoad: function (t) {
    var that = this;
    app.globalData.get_config('_ZEAI').then(function (t) {
      that.setData({
        color: app.globalData._ZEAI.color,
        rgbcolor: a.c16_rgb(app.globalData._ZEAI.color)
      });
    });
    app.globalData.get_navigationBarTopHeight(that);
    if (a.ifint(t.id)) {
      n = t.id;
    } else {
      for (var o = decodeURIComponent(t.scene), s = {}, u = 0; u < o.split('*').length; u++) {
        var r = o.split('*')[u].split('/');
        s[r[0]] = r[1];
      }
      n = a.ifint(s.f) ? s.f : 0;
    }
  },
  onShow: function () {
    this.init();
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      path: '/hnPages/huxuan/huxuan_detail?id=' + n
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.SHARE.imgurl,
      title: this.SHARE.title,
      query: 'id=' + n,
      path: '/hnPages/huxuan/huxuan_detail'
    };
  },
  methods: {
    init: function () {
      var that = this;
      a.ifint(n) ||
      uni.showModal({
        content: 'id跑路了',
        confirmColor: that.color,
        confirmText: '朕知道了',
        showCancel: false,
        success: function (t) {
          uni.navigateBack();
        }
      });
      that = this;
      uni.showLoading({
        title: '拼命加载中...',
        mask: true
      });
      var o = {
        submitok: 'huxuan_detail',
        openid: (t = uni.getStorageSync('COOK_U')).openid,
        id: n
      };
      app.globalData.ajax({
        url: 'huxuan.php',
        data: o,
        success: function (t) {
          1 == t.flag
              ? (that.setData({
                nTitle: t.D.title,
                tjarr: t.tjarr,
                SHARE: t.SHARE,
                D: t.D,
                BM: t.BM,
                MARQUEE: t.MARQUEE,
                DJS: t.DJS,
                KEFU: t.KEFU,
                BTN: t.BTN,
                ios_ifpay: t.ios_ifpay,
                content: a.escape2Html(t.D.content)
              }),
              1 == t.DJS.flag && that.DJSFn(t.DJS.difftime))
              : uni.showToast({
                title: t.msg,
                icon: 'none',
                mask: true
              });
          uni.hideLoading();
        }
      });
    },

    BTNfn: function () {
      var that = this;
      app.globalData.chklogin().then(function (o) {
        if (o) {
          switch (that.BTN.submitok) {
            case 'enter':
              /* uni.navigateTo({
                     url: '/hnPages/huxuan/huxuan_detail_ulist?id=' + n
                   });*/
              break;
            case 'bm':
              t = uni.getStorageSync('COOK_U');
              app.globalData.ajax({
                url: 'huxuan.php',
                data: {
                  submitok: 'huxuan_detail_bm',
                  id: n,
                  openid: t.openid
                },
                success: function (t) {
                  1 == t.flag
                      ? (uni.showToast({
                        title: t.msg,
                        mask: true,
                        duration: 3000
                      }),
                          setTimeout(function () {
                            that.init();
                          }, 2000))
                      : ((t.this = that), (t.url = 'no'), a.sorry(t));
                }
              });
              break;
            case 'pay':
              1 != that.ios_ifpay.flag
                  ? uni.getSystemInfo({
                    success: function (t) {
                      'ios' == t.platform
                          ? uni.showModal({
                            title: '温馨提示',
                            content: that.ios_ifpay.tips,
                            confirmColor: that.color,
                            cancelText: '返回',
                            confirmText: '联系经纪人',
                            success: function (t) {
                              t.confirm
                                  ? uni.redirectTo({
                                    url: '/myPages/hongniang/hongniang'
                                  })
                                  : t.cancel && uni.navigateBack();
                            }
                          })
                          : app.globalData.pay({
                            data: {
                              submitok: 'huxuan_bm_pay',
                              id: n
                            },
                            success: function (t) {
                              uni.showToast({
                                title: t.msg,
                                mask: true,
                                duration: 3000
                              });
                              setTimeout(function () {
                                that.init();
                              }, 3000);
                            },
                            fail: function (t) {
                              t.this = that;
                              t.url = 'no';
                              a.sorry(t);
                            }
                          });
                    }
                  })
                  : app.globalData.pay({
                    data: {
                      submitok: 'huxuan_bm_pay',
                      id: n
                    },
                    success: function (t) {
                      uni.showToast({
                        title: t.msg,
                        mask: true,
                        duration: 3000
                      });
                      setTimeout(function () {
                        that.init();
                      }, 3000);
                    },
                    fail: function (t) {
                      t.this = that;
                      t.url = 'no';
                      a.sorry(t);
                    }
                  });
          }
        } else {
          uni.navigateTo({
            url: '/pages/login/login'
          });
        }
      });
    },

    DJSFn: function (t) {
      var that = this;
      that.setInter = setInterval(function () {
        var i = 0;
        var a = 0;
        var e = 0;
        t > 0
            ? ((i = Math.floor(t / 3600)),
                (a = Math.floor(t / 60) - 60 * i),
                (e = Math.floor(t) - 60 * i * 60 - 60 * a),
            i <= 9 && (i = '0' + i),
            a <= 9 && (a = '0' + a),
            e <= 9 && (e = '0' + e),
                that.setData({
                  djs_H: i,
                  djs_M: a,
                  djs_S: e
                }),
                t--)
            : (clearInterval(that.setInter), that.init());
      }, 1000);
    },

    telFn: function (t) {
      var n = this.KEFU.tel;
      uni.makePhoneCall({
        phoneNumber: n
      });
    },

    kefuFn: function (t) {
      this.setData({
        kefushow: true
      });
    },

    kefu_closeFn: function () {
      this.setData({
        kefushow: false
      });
    },

    back: function () {
      this.setData({
        div_login: false
      });
    },

    mask_closeFn: function (t) {
      var that = this;
      var a = t.currentTarget.dataset.maskid;
      this.setData({
        mask_class: 'alpha100_0'
      });
      setTimeout(function () {
        that.setData(i({}, a, false));
      }, 500);
    },

    vipFn: function () {
      app.globalData.chklogin().then(function (t) {
        t
            ? uni.navigateTo({
              url: '/pagesA/my_vip/my_vip'
            })
            : uni.navigateTo({
              url: '/pages/login/login'
            });
      });
    },

    certFn: function () {
      app.globalData.chklogin().then(function (t) {
        t
            ? uni.navigateTo({
              url: '/myPages/cert/cert'
            })
            : uni.navigateTo({
              url: '/pages/login/login'
            });
      });
    },

    dataFn: function () {
      app.globalData.chklogin().then(function (t) {
        t
            ? uni.navigateTo({
              url: '/pagesA/reg/reg'
            })
            : uni.navigateTo({
              url: '/pages/login/login'
            });
      });
    },

    getPhoneNumber: function (t) {
      app.globalData.getPhoneNumber({
        e: t,
        url: '/pages/my/my'
      });
    },

    ifagreeFn: function (t) {
      1 == t.detail.value
          ? this.setData({
            ifagree: true
          })
          : this.setData({
            ifagree: false
          });
    },

    ifagree_passFn: function () {
      uni.showToast({
        title: '请先点击同意《用户协议》和《隐私条款》',
        icon: 'none',
        mask: true,
        duration: 3000
      });
    },

    emptyFn() {
      console.log('占位：函数 emptyFn 未声明');
    },

    gpsFn() {
      console.log('占位：函数 gpsFn 未声明');
    }
  }
};
</script>
<style>
@import 'huxuan_detail.css';
</style>
